<?php require_once('auth.php'); ?>
<html>
<head>
         <script type="text/javascript" src="simpletreemenu.js"></script>
         <link rel="stylesheet" type="text/css" href="simpletree.css" />

</head>

<body>


<!--    <div id="exco" style="float:right"> -->
<div id="exco" style="position:fixed; left:730px; top:200px"> 


<!-- <div id="exco" style="position:absolute; left:730px; top:200px"> -->
            <a href="javascript:ddtreemenu.flatten('treemenu3', 'expand')" style="font-family:'Arial';font-size:14pt;color:black;filter:Glow(color=#ff0000,strength=12);">Expand All</a> | <a href="javascript:ddtreemenu.flatten('treemenu3', 'contact')"style="font-family:'Arial';font-size:14pt;color:#000000;filter:Glow(color=#ff0000,strength=12);">Collapse All</a>

		
            <div id="iFrame1">
            <iframe name="iFrame1" width="500" height="360" src="make_str3.php" scrolling="no" frameborder="0"></iframe>
            </div>

</div>
 <div style="width:50%;border: 1px solid black;background-color:#ffffff; layer-background-color:#003366; visibility: visible">

  <ul id="treemenu3" class="treeview">
<?php
   include  "scandr2.php"	;
      //$path = "/opt/lampp/htdocs/music/music";
      $path = "home/rockedg1/public_html/badge/uploads";
      $songs = array();
      $iii = 0;
      $filestructure= scan_directory_recursively($path, false);
//    $filestructure = scan_directory_recursively($path, mp3);

foreach($filestructure as $content) {

 $songs[$iii][path] = $content[path];
 $songs[$iii][name] = $content[name];
 $songs[$iii][kind] = $content[kind];
 $songs[$iii][size] = $content[size];
 $songs[$iii][content] = $content[content];		 
		 
			 
++$iii;
}


	  $data = orderBy($songs, 'name');

foreach($data as $subcontent) {

  if ($subcontent[kind] =='directory'){
	 echo "<li>".$subcontent[name]."\n";
	 echo "<ul>"."\n";;

     echo scan_dd($subcontent[content]);
     echo "</ul>"."\n";

  }else{
         if ($subcontent[kind] =='file'){
         //$path = $subcontent[path];
         //echo "<li>".$subcontent[name]."</li>";
         echo "<li><a href='make_str3.php?id=".$subcontent[path]."' target='iFrame1'>".$subcontent[name]."</a></li>"."\n";
         }
       }
}



 function scan_dd($array){
 
 foreach($array as $subcontent) {
 $songs[$i][path] = $subcontent[path];
 $songs[$i][name] = $subcontent[name];
 $songs[$i][kind] = $subcontent[kind];
 $songs[$i][size] = $subcontent[size];
 $songs[$i][content] = $subcontent[content];
    if ($songs[$i][kind] =='directory'){
		 echo "<li>".$subcontent[name]."\n";
	 echo "<ul>"."\n";;
	$go_array = $subcontent[content];
	echo scan_dd ($go_array);
    echo "</ul>"."\n";
    }
++$i;
}
$data = orderBy($songs, 'name');

  foreach($data as $subcontent) {

    if ($subcontent[kind] =='file'){
         //$path = $songs[$i][path];
         //echo "<li>".$subcontent[name]."</li>";
         echo "<li><a href='make_str3.php?id=".$subcontent[path]."' target='iFrame1'>".$subcontent[name]."</a></li>"."\n";
         }

    }

}

 function orderBy($data, $field) { 
	$code = "return strnatcmp(\$a['$field'], \$b['$field']);";
	usort($data, create_function('$a,$b', $code));
	 return $data;
	  } 
	  



?>
</ul>
<script type="text/javascript">
ddtreemenu.createTree("treemenu3", true)
</script>

</div>
</body>
</html>
